package cn.hl.sfzy.service.impl;

import cn.hl.sfzy.entity.Charge;
import cn.hl.sfzy.mapper.ChargeMapper;
import cn.hl.sfzy.service.ChargeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Date 2024年10月23日
 */
//取消所有黄色警告
//@SuppressWarnings("all")
@Service
public class ChargeServiceImpl implements ChargeService {
    @Autowired
    private ChargeMapper chargeMapper;

    @Override
    public int add(Charge charge) {
        return chargeMapper.insert(charge);
    }

    @Override
    public int remove(Long[] id) {
        return chargeMapper.remove(id);
    }

    @Override
    public int edit(Charge charge) {
        return chargeMapper.updateByPrimaryKeySelective(charge);
    }

    public List<Charge> find(Charge charge) {
        return chargeMapper.find(charge);
    }

    @Override
    public PageInfo<Charge> findByPage(int pageNum, int pageSize, Charge charge) {
        PageHelper.startPage(pageNum, pageSize);
        List<Charge> charges = chargeMapper.find(charge);
        return new PageInfo<>(charges);
    }
}
